package com.haynes.social.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @Author Haynes
 * @Date 2023/5/26 21:05
 * @PackageName:com.haynes.store.config
 * @ClassName: SwaggerConfig
 */
@Configuration
public class SwaggerConfig {
    @Bean
    public Docket createRestApi(){
        return new Docket(DocumentationType.SWAGGER_2)
                .pathMapping("/")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.haynes.social.controller"))
                .paths(PathSelectors.any())
                .build()
                .apiInfo(new ApiInfoBuilder()
                        .title("Social社交网站")
                        .description("用于网友在线交流平台")
                        .version("1.0")
                        .contact(new Contact("Haynes","http://localhost:7071/","18538764478@163.com")
                        )
                        .license("The Apache License")
                        .licenseUrl("http://localhost:7071/")
                        .build());
    }
}
